<template>
  <view class="search-container">
    <!-- 搜索头部 -->
    <view class="search-header" :style="{ paddingTop: statusBarHeight + 'px' }">
      <view class="search-bar">
        <view class="search-input-wrapper">
          <u-icon name="search" color="#999" size="18"></u-icon>
          <input
            v-model="searchKeyword"
            placeholder="搜索圈子、用户、内容"
            class="search-input"
            :focus="true"
            @input="handleSearchInput"
            @confirm="handleSearch"
          />
          <u-icon 
            v-if="searchKeyword"
            name="close-circle-fill" 
            color="#ccc" 
            size="18" 
            @click="clearSearch"
          ></u-icon>
        </view>
        <text class="cancel-btn" @click="handleCancel">取消</text>
      </view>
      
      <!-- 搜索建议 -->
      <view class="search-suggestions" v-if="showSuggestions && suggestions.length > 0">
        <view 
          class="suggestion-item"
          v-for="item in suggestions" 
          :key="item.id"
          @click="selectSuggestion(item)"
        >
          <u-icon name="search" color="#999" size="16"></u-icon>
          <text class="suggestion-text">{{ item.text }}</text>
        </view>
      </view>
    </view>

    <!-- 主要内容区域 -->
    <scroll-view 
      class="main-content" 
      scroll-y 
      @scrolltolower="loadMore"
      v-if="hasSearched"
    >
      <!-- 搜索结果标签页 -->
      <view class="result-tabs">
        <view 
          class="tab-item"
          :class="{ active: currentTab === 'all' }"
          @click="switchTab('all')"
        >
          <text class="tab-text">全部</text>
        </view>
        <view 
          class="tab-item"
          :class="{ active: currentTab === 'posts' }"
          @click="switchTab('posts')"
        >
          <text class="tab-text">帖子</text>
        </view>
        <view 
          class="tab-item"
          :class="{ active: currentTab === 'users' }"
          @click="switchTab('users')"
        >
          <text class="tab-text">用户</text>
        </view>
        <view 
          class="tab-item"
          :class="{ active: currentTab === 'circles' }"
          @click="switchTab('circles')"
        >
          <text class="tab-text">圈子</text>
        </view>
      </view>

      <!-- 搜索结果列表 -->
      <view class="search-results">
        <!-- 全部结果 -->
        <view v-if="currentTab === 'all'">
          <!-- 用户结果 -->
          <view class="result-section" v-if="userResults.length > 0">
            <view class="section-header">
              <text class="section-title">用户</text>
              <text class="section-more" @click="switchTab('users')">查看更多</text>
            </view>
            <view class="user-list">
              <view 
                class="user-item modern-card"
                v-for="user in userResults.slice(0, 3)" 
                :key="user.uid"
                @click="handleUserProfile(user)"
              >
                <u-avatar :src="user.avatar" size="45"></u-avatar>
                <view class="user-info">
                  <text class="username">{{ user.username }}</text>
                  <text class="user-desc">{{ user.description }}</text>
                </view>
                <u-button 
                  v-if="!user.isFollowed"
                  type="primary"
                  size="mini"
                  :custom-style="{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'none' }"
                  @click.stop="handleFollow(user)"
                >
                  关注
                </u-button>
              </view>
            </view>
          </view>

          <!-- 圈子结果 -->
          <view class="result-section" v-if="circleResults.length > 0">
            <view class="section-header">
              <text class="section-title">圈子</text>
              <text class="section-more" @click="switchTab('circles')">查看更多</text>
            </view>
            <view class="circle-list">
              <view 
                class="circle-item modern-card"
                v-for="circle in circleResults.slice(0, 3)" 
                :key="circle.id"
                @click="handleCircleDetail(circle)"
              >
                <image :src="circle.cover_image" class="circle-cover" mode="aspectFill"></image>
                <view class="circle-info">
                  <text class="circle-name">{{ circle.cate_name }}</text>
                  <text class="circle-desc">{{ circle.description }}</text>
                  <text class="circle-stats">{{ circle.member_count }}成员</text>
                </view>
              </view>
            </view>
          </view>

          <!-- 帖子结果 -->
          <view class="result-section" v-if="postResults.length > 0">
            <view class="section-header">
              <text class="section-title">帖子</text>
              <text class="section-more" @click="switchTab('posts')">查看更多</text>
            </view>
            <view class="post-list">
              <view 
                class="post-item modern-card"
                v-for="post in postResults.slice(0, 5)" 
                :key="post.id"
                @click="handlePostDetail(post)"
              >
                <view class="post-header">
                  <u-avatar :src="post.userAvatar" size="30"></u-avatar>
                  <text class="post-username">{{ post.username }}</text>
                  <text class="post-time">{{ formatTime(post.create_time) }}</text>
                </view>
                <text class="post-content">{{ post.content }}</text>
                <view class="post-images" v-if="post.mediaList && post.mediaList.length > 0">
                  <image 
                    :src="post.mediaList[0]" 
                    class="post-image" 
                    mode="aspectFill"
                  ></image>
                </view>
              </view>
            </view>
          </view>
        </view>

        <!-- 单独的结果页面 -->
        <view v-else>
          <!-- 用户结果页面 -->
          <view v-if="currentTab === 'users'" class="user-list">
            <view 
              class="user-item modern-card"
              v-for="user in userResults" 
              :key="user.uid"
              @click="handleUserProfile(user)"
            >
              <u-avatar :src="user.avatar" size="50"></u-avatar>
              <view class="user-info">
                <text class="username">{{ user.username }}</text>
                <text class="user-desc">{{ user.description }}</text>
                <view class="user-stats">
                  <text class="stat-text">{{ user.followersCount }}粉丝</text>
                  <text class="stat-text">{{ user.postCount }}帖子</text>
                </view>
              </view>
              <u-button 
                v-if="!user.isFollowed"
                type="primary"
                size="small"
                :custom-style="{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'none' }"
                @click.stop="handleFollow(user)"
              >
                关注
              </u-button>
              <u-button 
                v-else
                type="info"
                size="small"
                plain
                @click.stop="handleUnfollow(user)"
              >
                已关注
              </u-button>
            </view>
          </view>

          <!-- 圈子结果页面 -->
          <view v-if="currentTab === 'circles'" class="circle-list">
            <view 
              class="circle-item modern-card"
              v-for="circle in circleResults" 
              :key="circle.id"
              @click="handleCircleDetail(circle)"
            >
              <image :src="circle.cover_image" class="circle-cover" mode="aspectFill"></image>
              <view class="circle-info">
                <text class="circle-name">{{ circle.cate_name }}</text>
                <text class="circle-desc">{{ circle.description }}</text>
                <view class="circle-stats">
                  <text class="stat-text">{{ circle.member_count }}成员</text>
                  <text class="stat-text">{{ circle.post_count }}帖子</text>
                </view>
              </view>
              <u-button 
                v-if="!circle.isJoined"
                type="primary"
                size="small"
                :custom-style="{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', border: 'none' }"
                @click.stop="handleJoinCircle(circle)"
              >
                加入
              </u-button>
            </view>
          </view>

          <!-- 帖子结果页面 -->
          <view v-if="currentTab === 'posts'" class="post-list">
            <view 
              class="post-item modern-card"
              v-for="post in postResults" 
              :key="post.id"
              @click="handlePostDetail(post)"
            >
              <view class="post-header">
                <u-avatar :src="post.userAvatar" size="35"></u-avatar>
                <view class="header-info">
                  <text class="post-username">{{ post.username }}</text>
                  <text class="post-time">{{ formatTime(post.create_time) }}</text>
                </view>
              </view>
              <text class="post-content">{{ post.content }}</text>
              <view class="post-images" v-if="post.mediaList && post.mediaList.length > 0">
                <image 
                  v-for="(img, index) in post.mediaList.slice(0, 3)" 
                  :key="index"
                  :src="img" 
                  class="post-image" 
                  mode="aspectFill"
                ></image>
              </view>
              <view class="post-stats">
                <view class="stat-item">
                  <u-icon name="heart" color="#999" size="14"></u-icon>
                  <text class="stat-text">{{ post.likeCount }}</text>
                </view>
                <view class="stat-item">
                  <u-icon name="chat" color="#999" size="14"></u-icon>
                  <text class="stat-text">{{ post.commentCount }}</text>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>

      <!-- 加载更多 -->
      <view class="load-more" v-if="hasMore">
        <u-loading-icon v-if="loading" color="#667eea" size="20"></u-loading-icon>
        <text class="load-text">{{ loading ? '加载中...' : '上拉加载更多' }}</text>
      </view>
      
      <!-- 无结果 -->
      <view class="no-results" v-if="!loading && !hasResults">
        <u-icon name="search" color="#ccc" size="60"></u-icon>
        <text class="no-results-text">没有找到相关内容</text>
        <text class="no-results-tip">试试其他关键词吧</text>
      </view>
    </scroll-view>

    <!-- 默认页面内容 -->
    <view class="default-content" v-if="!hasSearched">
      <!-- 热门搜索 -->
      <view class="hot-searches">
        <view class="section-header">
          <text class="section-title">热门搜索</text>
        </view>
        <view class="hot-tags">
          <text 
            class="hot-tag"
            v-for="tag in hotSearches" 
            :key="tag"
            @click="selectHotSearch(tag)"
          >
            {{ tag }}
          </text>
        </view>
      </view>

      <!-- 搜索历史 -->
      <view class="search-history" v-if="searchHistory.length > 0">
        <view class="section-header">
          <text class="section-title">搜索历史</text>
          <u-icon name="trash" color="#999" size="16" @click="clearHistory"></u-icon>
        </view>
        <view class="history-list">
          <view 
            class="history-item"
            v-for="item in searchHistory" 
            :key="item"
            @click="selectHistory(item)"
          >
            <u-icon name="time" color="#999" size="16"></u-icon>
            <text class="history-text">{{ item }}</text>
            <u-icon name="close" color="#ccc" size="14" @click.stop="removeHistory(item)"></u-icon>
          </view>
        </view>
      </view>
    </view>

    <!-- Toast提示 -->
    
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0,
      searchKeyword: '',
      showSuggestions: false,
      hasSearched: false,
      currentTab: 'all',
      loading: false,
      hasMore: true,
      page: 1,
      pageSize: 10,
      
      // 搜索建议
      suggestions: [],
      
      // 热门搜索
      hotSearches: ['校园生活', '摄影技巧', '美食分享', '旅行攻略', '学习方法', '运动健身'],
      
      // 搜索历史
      searchHistory: [],
      
      // 搜索结果
      userResults: [],
      circleResults: [],
      postResults: []
    }
  },
  
  computed: {
    hasResults() {
      return this.userResults.length > 0 || this.circleResults.length > 0 || this.postResults.length > 0
    }
  },
  
  onLoad(options) {
    this.initPage()
    
    // 如果有传入的关键词，直接搜索
    if (options.keyword) {
      this.searchKeyword = decodeURIComponent(options.keyword)
      this.handleSearch()
    }
  },
  
  methods: {
    // 初始化页面
    initPage() {
      const systemInfo = uni.getSystemInfoSync()
      this.statusBarHeight = systemInfo.statusBarHeight || 0
      
      // 加载搜索历史
      this.loadSearchHistory()
    },
    
    // 加载搜索历史
    loadSearchHistory() {
      const history = uni.getStorageSync('searchHistory') || []
      this.searchHistory = history.slice(0, 10) // 最多显示10条
    },
    
    // 保存搜索历史
    saveSearchHistory(keyword) {
      let history = uni.getStorageSync('searchHistory') || []
      
      // 移除重复项
      history = history.filter(item => item !== keyword)
      
      // 添加到开头
      history.unshift(keyword)
      
      // 限制数量
      history = history.slice(0, 20)
      
      uni.setStorageSync('searchHistory', history)
      this.searchHistory = history.slice(0, 10)
    },
    
    // 搜索输入处理
    handleSearchInput() {
      if (this.searchKeyword.trim()) {
        this.showSuggestions = true
        this.loadSuggestions()
      } else {
        this.showSuggestions = false
        this.suggestions = []
      }
    },
    
    // 加载搜索建议
    async loadSuggestions() {
      try {
        // 这里应该调用API获取搜索建议
        // const res = await this.$api.getSearchSuggestions(this.searchKeyword)
        
        // 模拟数据
        const mockSuggestions = [
          { id: 1, text: this.searchKeyword + '相关内容' },
          { id: 2, text: this.searchKeyword + '话题' },
          { id: 3, text: this.searchKeyword + '用户' }
        ]
        
        this.suggestions = mockSuggestions
      } catch (error) {
        console.error('加载搜索建议失败:', error)
      }
    },
    
    // 执行搜索
    async handleSearch() {
      if (!this.searchKeyword.trim()) {
        this.showToast('请输入搜索关键词', 'error')
        return
      }
      
      this.showSuggestions = false
      this.hasSearched = true
      this.page = 1
      
      // 保存搜索历史
      this.saveSearchHistory(this.searchKeyword.trim())
      
      // 执行搜索
      await this.performSearch()
    },
    
    // 执行搜索请求
    async performSearch() {
      this.loading = true
      
      try {
        // 这里应该调用API进行搜索
        // const res = await this.$api.search({
        //   keyword: this.searchKeyword,
        //   type: this.currentTab,
        //   page: this.page,
        //   pageSize: this.pageSize
        // })
        
        // 模拟搜索结果
        const results = this.generateMockResults()
        
        if (this.page === 1) {
          this.userResults = results.users
          this.circleResults = results.circles
          this.postResults = results.posts
        } else {
          // 加载更多时追加结果
          if (this.currentTab === 'users' || this.currentTab === 'all') {
            this.userResults.push(...results.users)
          }
          if (this.currentTab === 'circles' || this.currentTab === 'all') {
            this.circleResults.push(...results.circles)
          }
          if (this.currentTab === 'posts' || this.currentTab === 'all') {
            this.postResults.push(...results.posts)
          }
        }
        
        this.hasMore = results.hasMore
      } catch (error) {
        console.error('搜索失败:', error)
        this.showToast('搜索失败，请重试', 'error')
      } finally {
        this.loading = false
      }
    },
    
    // 生成模拟搜索结果
    generateMockResults() {
      const users = []
      const circles = []
      const posts = []
      
      // 生成用户结果
      for (let i = 0; i < 5; i++) {
        users.push({
          uid: Date.now() + i,
          username: '用户' + (1000 + i),
          avatar: `https://cdn.uviewui.com/uview/album/${(i % 6) + 1}.jpg`,
          description: '这是一个热爱生活的用户',
          followersCount: Math.floor(Math.random() * 1000),
          postCount: Math.floor(Math.random() * 100),
          isFollowed: Math.random() > 0.7
        })
      }
      
      // 生成圈子结果
      for (let i = 0; i < 4; i++) {
        circles.push({
          id: Date.now() + i,
          cate_name: '圈子' + (i + 1),
          description: '这是一个有趣的圈子',
          cover_image: `https://cdn.uviewui.com/uview/album/${(i % 6) + 1}.jpg`,
          member_count: Math.floor(Math.random() * 5000),
          post_count: Math.floor(Math.random() * 1000),
          isJoined: Math.random() > 0.6
        })
      }
      
      // 生成帖子结果
      for (let i = 0; i < 8; i++) {
        posts.push({
          id: Date.now() + i,
          username: '用户' + (1000 + i),
          userAvatar: `https://cdn.uviewui.com/uview/album/${(i % 6) + 1}.jpg`,
          content: `这是一个包含"${this.searchKeyword}"的帖子内容，分享一些有趣的想法和经历。`,
          mediaList: Math.random() > 0.5 ? [`https://cdn.uviewui.com/uview/album/${(i % 6) + 1}.jpg`] : [],
          create_time: new Date(Date.now() - Math.random() * 86400000 * 7).toISOString(),
          likeCount: Math.floor(Math.random() * 100),
          commentCount: Math.floor(Math.random() * 50)
        })
      }
      
      return {
        users,
        circles,
        posts,
        hasMore: Math.random() > 0.3
      }
    },
    
    // 切换标签页
    switchTab(tab) {
      this.currentTab = tab
      this.page = 1
      this.performSearch()
    },
    
    // 加载更多
    async loadMore() {
      if (!this.hasMore || this.loading) return
      
      this.page++
      await this.performSearch()
    },
    
    // 选择搜索建议
    selectSuggestion(suggestion) {
      this.searchKeyword = suggestion.text
      this.handleSearch()
    },
    
    // 选择热门搜索
    selectHotSearch(tag) {
      this.searchKeyword = tag
      this.handleSearch()
    },
    
    // 选择搜索历史
    selectHistory(keyword) {
      this.searchKeyword = keyword
      this.handleSearch()
    },
    
    // 清空搜索
    clearSearch() {
      this.searchKeyword = ''
      this.showSuggestions = false
      this.suggestions = []
    },
    
    // 清空搜索历史
    clearHistory() {
      uni.showModal({
        title: '确认清空',
        content: '确定要清空所有搜索历史吗？',
        success: (res) => {
          if (res.confirm) {
            uni.removeStorageSync('searchHistory')
            this.searchHistory = []
            this.showToast('已清空搜索历史', 'success')
          }
        }
      })
    },
    
    // 删除单条搜索历史
    removeHistory(keyword) {
      let history = uni.getStorageSync('searchHistory') || []
      history = history.filter(item => item !== keyword)
      uni.setStorageSync('searchHistory', history)
      this.searchHistory = history.slice(0, 10)
    },
    
    // 格式化时间
    formatTime(timeStr) {
      const time = new Date(timeStr)
      const now = new Date()
      const diff = now - time
      
      if (diff < 60000) return '刚刚'
      if (diff < 3600000) return Math.floor(diff / 60000) + '分钟前'
      if (diff < 86400000) return Math.floor(diff / 3600000) + '小时前'
      if (diff < 604800000) return Math.floor(diff / 86400000) + '天前'
      
      return time.toLocaleDateString()
    },
    
    // 事件处理方法
    handleCancel() {
      uni.navigateBack()
    },
    
    handleUserProfile(user) {
      this.$tab.navigateTo(`/pages/user/profile?uid=${user.uid}`)
    },
    
    handleCircleDetail(circle) {
      this.$tab.navigateTo(`/pages/circles/detail?id=${circle.id}`)
    },
    
    handlePostDetail(post) {
      this.$tab.navigateTo(`/pages/post/detail?id=${post.id}`)
    },
    
    async handleFollow(user) {
      try {
        user.isFollowed = true
        user.followersCount++
        this.showToast('关注成功', 'success')
      } catch (error) {
        this.showToast('关注失败，请重试', 'error')
      }
    },
    
    async handleUnfollow(user) {
      try {
        user.isFollowed = false
        user.followersCount--
        this.showToast('已取消关注', 'success')
      } catch (error) {
        this.showToast('操作失败，请重试', 'error')
      }
    },
    
    async handleJoinCircle(circle) {
      try {
        circle.isJoined = true
        circle.member_count++
        this.showToast('加入成功', 'success')
      } catch (error) {
        this.showToast('加入失败，请重试', 'error')
      }
    },
    
    showToast(title, type = 'default') {
      // 使用 uView 2.0 的 toast 方法
      this.$u.toast(title)
    }
  }
}
</script>

<style lang="scss" scoped>
.search-container {
  min-height: 100vh;
  background: #f8f9fa;
}

.search-header {
  background: white;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  
  .search-bar {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    gap: 10px;
    
    .search-input-wrapper {
      flex: 1;
      display: flex;
      align-items: center;
      background: #f8f9fa;
      border-radius: 20px;
      padding: 8px 15px;
      gap: 8px;
      
      .search-input {
        flex: 1;
        font-size: 14px;
        color: #333;
        background: transparent;
        border: none;
        outline: none;
      }
    }
    
    .cancel-btn {
      font-size: 14px;
      color: #667eea;
    }
  }
  
  .search-suggestions {
    background: white;
    border-top: 1px solid #f0f0f0;
    max-height: 200px;
    overflow-y: auto;
    
    .suggestion-item {
      display: flex;
      align-items: center;
      padding: 12px 15px;
      gap: 10px;
      border-bottom: 1px solid #f8f9fa;
      
      .suggestion-text {
        font-size: 14px;
        color: #333;
      }
    }
  }
}

.main-content {
  padding-top: 120px;
  height: calc(100vh - 120px);
  padding-left: 15px;
  padding-right: 15px;
}

.result-tabs {
  display: flex;
  background: white;
  border-radius: 15px;
  margin-bottom: 15px;
  padding: 5px;
  
  .tab-item {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    border-radius: 10px;
    
    &.active {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      
      .tab-text {
        color: white;
        font-weight: 600;
      }
    }
    
    .tab-text {
      font-size: 14px;
      color: #999;
    }
  }
}

.search-results {
  .result-section {
    margin-bottom: 20px;
    
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      
      .section-title {
        font-size: 16px;
        font-weight: 600;
        color: #333;
      }
      
      .section-more {
        font-size: 14px;
        color: #667eea;
      }
    }
  }
  
  .user-list {
    .user-item {
      display: flex;
      align-items: center;
      padding: 15px;
      margin-bottom: 10px;
      
      .user-info {
        flex: 1;
        margin-left: 12px;
        
        .username {
          font-size: 15px;
          font-weight: 600;
          color: #333;
          display: block;
          margin-bottom: 4px;
        }
        
        .user-desc {
          font-size: 13px;
          color: #666;
          margin-bottom: 6px;
          display: block;
        }
        
        .user-stats {
          display: flex;
          gap: 15px;
          
          .stat-text {
            font-size: 12px;
            color: #999;
          }
        }
      }
    }
  }
  
  .circle-list {
    .circle-item {
      display: flex;
      padding: 15px;
      margin-bottom: 10px;
      
      .circle-cover {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        margin-right: 12px;
      }
      
      .circle-info {
        flex: 1;
        
        .circle-name {
          font-size: 15px;
          font-weight: 600;
          color: #333;
          display: block;
          margin-bottom: 4px;
        }
        
        .circle-desc {
          font-size: 13px;
          color: #666;
          margin-bottom: 6px;
          display: block;
        }
        
        .circle-stats {
          display: flex;
          gap: 15px;
          
          .stat-text {
            font-size: 12px;
            color: #999;
          }
        }
      }
    }
  }
  
  .post-list {
    .post-item {
      padding: 15px;
      margin-bottom: 10px;
      
      .post-header {
        display: flex;
        align-items: center;
        margin-bottom: 10px;
        
        .header-info {
          margin-left: 10px;
          flex: 1;
          
          .post-username {
            font-size: 14px;
            font-weight: 600;
            color: #333;
            display: block;
            margin-bottom: 2px;
          }
          
          .post-time {
            font-size: 12px;
            color: #999;
          }
        }
      }
      
      .post-content {
        font-size: 14px;
        color: #666;
        line-height: 1.5;
        margin-bottom: 10px;
        display: block;
      }
      
      .post-images {
        display: flex;
        gap: 8px;
        margin-bottom: 10px;
        
        .post-image {
          width: 80px;
          height: 80px;
          border-radius: 8px;
        }
      }
      
      .post-stats {
        display: flex;
        gap: 20px;
        
        .stat-item {
          display: flex;
          align-items: center;
          gap: 4px;
          
          .stat-text {
            font-size: 12px;
            color: #999;
          }
        }
      }
    }
  }
}

.load-more, .no-results {
  text-align: center;
  padding: 30px 20px;
  
  .load-text, .no-results-text {
    font-size: 14px;
    color: #999;
    margin-top: 10px;
    display: block;
  }
  
  .no-results-tip {
    font-size: 12px;
    color: #ccc;
    margin-top: 5px;
    display: block;
  }
}

.default-content {
  padding-top: 120px;
  padding-left: 15px;
  padding-right: 15px;
  
  .hot-searches, .search-history {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    
    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 15px;
      
      .section-title {
        font-size: 16px;
        font-weight: 600;
        color: #333;
      }
    }
    
    .hot-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      
      .hot-tag {
        background: #f8f9fa;
        color: #666;
        font-size: 13px;
        padding: 6px 12px;
        border-radius: 15px;
        
        &:nth-child(1), &:nth-child(2) {
          background: rgba(102, 126, 234, 0.1);
          color: #667eea;
        }
      }
    }
    
    .history-list {
      .history-item {
        display: flex;
        align-items: center;
        padding: 10px 0;
        gap: 10px;
        border-bottom: 1px solid #f8f9fa;
        
        &:last-child {
          border-bottom: none;
        }
        
        .history-text {
          flex: 1;
          font-size: 14px;
          color: #333;
        }
      }
    }
  }
}
</style>
